import React , {Component}from 'react';
import { Modal, Button } from 'antd';
import InputBox from '../../../common/InputBox.js'
import Select from '../../../common/Select.js'
import  Confirm from '../../../common/Confirm.js'


export default class Handlelog extends React.Component {
    constructor(props){
        super(props);
        this.state = {
            visible: false,
            text:1
        }

        this.arr=[
            {company:"山东省德州市制衣坊",operating:"刘大盛",time:"2017-03-02 14:30",operate:"发布订单",operatelog:"［待接收］订单已发布"},
            {company:"山东省德州市制衣坊",operating:"刘大盛",time:"2017-03-02 14:30",operate:"发布订单",operatelog:"［待接收］订单已发布"},
            {company:"山东省德州市制衣坊",operating:"刘大盛",time:"2017-03-02 14:30",operate:"发布订单",operatelog:"［待接收］订单已发布"},
            {company:"山东省德州市制衣坊",operating:"刘大盛",time:"2017-03-02 14:30",operate:"发布订单",operatelog:"［待接收］订单已发布"}
        ]

    }

    componentWillMount() {

    }

    state = { visible: false }
    showModal = () => {
        this.setState({
            visible: true,
        });
    }
    handleOk = (e) => {
        // console.log(e);
        this.setState({
            visible: false,
        });
    }
    handleCancel = (e) => {
        // console.log(e);
        this.setState({
            visible: false,
        });
    }

    changePageNum(e){
        let numtest = /^[0-9]*$/;
        let text = e.target.value
        if(!numtest.test(text)){
            return
        }
        this.setState({
            text:text
        });
    }

    log(){
        return this.arr.map((context,index)=>{
            return(
                <tr key={index}>
                    <th style={{width:160,height:40,lineHeight:"40px"}}>{context.company}</th>
                    <th style={{width:70,height:40,lineHeight:"40px"}}>{context.operating}</th>
                    <th style={{width:120,height:40,lineHeight:"40px"}}>{context.time}</th>
                    <th style={{width:70,height:40,lineHeight:"40px"}}>{context.operate}</th>
                    <th style={{width:130,height:40,lineHeight:"40px"}}>{context.operatelog}</th>
                </tr>


            )
        })
    }

    render(){
        return (
                <Modal visible={this.state.visible} onOk={this.handleOk} onCancel={this.handleCancel} style={{width:"634px",height:"565px",display:"block"}} title={"操作日志"}>
                    <table style={{marginLeft:"10px"}}>
                        <thead>
                            <tr>
                                <th style={{width:160,height:40,lineHeight:"40px",background:"#f2f2f2"}}>公司名称</th>
                                <th style={{width:70,height:40,lineHeight:"40px",background:"#f2f2f2"}}>操作人</th>
                                <th style={{width:120,height:40,lineHeight:"40px",background:"#f2f2f2"}}>时间</th>
                                <th style={{width:70,height:40,lineHeight:"40px",background:"#f2f2f2"}}>操作</th>
                                <th style={{width:130,height:40,lineHeight:"40px",background:"#f2f2f2"}}>操作日志</th>
                            </tr>
                        </thead>
                        <tbody>
                                {
                                    this.log()
                                }
                        </tbody>
                    </table>

                    <ul style={{width:390,height:26,position:"absolute",right:0,bottom:32,position:"absolute",left:"200px",top:"400px"}}>
                        <li style={{float:"left",height:30,lineHeight:"30px",marginRight:"15px"}} >总计<span>2</span>条</li>
                        <li style={{float:"left",height:30,lineHeight:"30px",marginRight:"15px"}}>每页<span>2</span>条</li>

                        <li style={{float:"left",height:30,lineHeight:"30px",marginRight:"15px"}}>第<input type="text" className="page_input" value={this.state.text} onChange={this.changePageNum.bind(this)}/>页</li>
                        <li style={{float:"left",height:30,lineHeight:"30px",marginRight:"15px"}}>共<span>1</span>页</li>

                        <li style={{float:"left",height:30,lineHeight:"30px"}}>
                            <i style={{cursor:"pointer"}}> 上一页</i>
                            <i style={{cursor:"pointer"}}> 下一页</i>
                        </li>
                    </ul>
                </Modal>
        )
    }
}
